<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta name="robots" content="noindex,nofollow">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="layui/css/layui.css" />
<link rel="stylesheet" type="text/css" href="css/x.css"/>
<link rel="stylesheet" href="./css/font.css">
<title>友情链接管理</title>
<script src="js/common.js" type="text/javascript"></script>
<script src="js/main.js" type="text/javascript"></script>
<script src="layui/layui.js" type="text/javascript"></script>
</head>
<body>
<!--当前导航-->

<div class="layui-fluid">
  <div class="r_content pd15">
    <div style="overflow-x: auto">
<?php
$numPerPage=30;
$whereStr='';
if(!empty($keyword)) $whereStr=" where url like '%".$keyword."%' or webname like '%".$keyword."%' or msg like '%".$keyword."%' ";
$page = isset($page) ? intval($page) : 1;
if($page==0) $page=1;
$csqlStr="select count(*) as dd from `sea_flink`$whereStr";
$row = $dsql->GetOne($csqlStr);
if(is_array($row)){
$TotalResult = $row['dd'];
}else{
$TotalResult = 0;
}
$TotalPage = ceil($TotalResult/$numPerPage);
if ($page>$TotalPage) $page=$TotalPage;
$limitstart = ($page-1) * $numPerPage;
if($limitstart<0) $limitstart=0;
$sqlStr="select * from `sea_flink`$whereStr order by sortrank asc limit $limitstart,$numPerPage";
?>
<div><a class="layui-btn layui-btn-sm"  href="?action=new" title="新增管理员">新增&nbsp;&nbsp;<i class="iconfont">&#xe6b9;</i></a></div>
<form action="" method="post" name="linkform">

<table class="layui-table" style="min-width:1170px;">
    <TR align="center" style="background-color: #f6f6f6;" >
      <TD width="6%">ID</TD>
      <TD>名称</TD>
      <TD>网址</TD>
      <TD>类型</TD>
	  <TD>显示</TD>
      <TD>排序</TD>	  
      <TD>操作</TD>
    </TR>
<?php
$dsql->SetQuery($sqlStr);
$dsql->Execute('flink_list');
while($row=$dsql->GetObject('flink_list'))
{
$aid=$row->id;
?>
     <TR align="center" <?php if($id==$aid) echo " class=\"editlast\"";?>>
      <TD><input type="checkbox" value="<?php echo $aid;?>" name="e_id[]"  class="checkbox" />&nbsp;<?php echo $aid;?></TD>
      <TD><input type="text" name="webname<?php echo $aid;?>" value="<?php echo $row->webname;?>" size="20"/></TD>
      <TD><input name="url<?php echo $aid;?>" type="text" value="<?php echo $row->url;?>"  size="30"/></TD>
      <td><?php if(empty($row->logo)) echo "文字链接"; else echo "图片链接";?></td>
	  <td><?php if($row->ischeck==1) echo "显示"; else echo "隐藏";?></td>
      <TD><input name="sortrank<?php echo $aid;?>" type="text" value="<?php echo $row->sortrank;?>"  size="10"/></TD>
      <TD><a  href="?action=last&id=<?php echo $aid;?>">上移</a> <a href="?action=next&id=<?php echo $aid;?>">下移</a> <a href="?action=edit&id=<?php echo $aid;?>">查看/编辑</a> <a  onclick="if(confirm('确定要删除吗')){return true;}else{return false;}" href="?action=del&id=<?php echo $aid;?>">删除</a></TD>
    </TR>
<?php
}
?>
    <tr><td  colspan="6"><div class="pages"><label>全选&nbsp;&nbsp;<input type="checkbox" name="chkall" id="chkall" class="checkbox" onclick="checkAll(this.checked,'input','e_id[]')" /></label>&nbsp;&nbsp;<label>反选&nbsp;&nbsp;<input type="checkbox" name="chkothers" id="chkothers" class="checkbox" onclick="checkOthers('input','e_id[]')" /></label>&nbsp;&nbsp;&nbsp;&nbsp;<input type="submit" value="批量删除" onclick="if(confirm('确定要删除吗')){linkform.action='?action=delall';}else{return false}" class="rb1"  />&nbsp;&nbsp;<input type="submit" value="批量修改选中友情链接" name="Submit"  class="rb1"  onclick="linkform.action='?action=editall';"/></div></td></tr>
</TABLE>
<div id="new_pages" class="layui-fluid"></div>
</form> 
</div>
</div>
</div>
</body>
<script type="text/JavaScript">
	<?php if($idgroup!=""): ?>
    setInterval(getLiveStat,1000,'id_group','stat_group');
	<?php endif; ?>	
	
	layui.use(['laypage', 'layer'], function(){
	  var laypage = layui.laypage
	  ,layer = layui.layer;
	  laypage.render({
	      elem: 'new_pages'
	      ,count: <?php echo $TotalResult;?>
		  ,limit: <?php echo $numPerPage;?>
		  ,curr:<?php echo $page;?>
	      ,layout: ['count', 'prev', 'page', 'next', 'skip']
	      ,jump: function(obj,first){
			  if(!first){
				location.href = '?page='+ obj.curr;
			}
	      }
	    });

</script>
</html>
